Skip to content

Conversation

@anna-git
Copy link
Contributor

@anna-git anna-git commented Oct 22, 2025

Context

Part of Configuration Inversion (Step 5) - Stack progress:

  1. #7548 - Add GitLab step and JSON configuration file
  2. #7688 - Cleanup configuration / platform keys + source generator
  3. #7698 - Aliases handling via source generator
  4. #7689 - Analyzers for platform and ConfigurationBuilder
  5. #7697 - Replace manual ConfigurationKeys by generated ones in the whole solution (this PR)

Summary of changes

Fixed the ConfigurationKeysGenerator to properly read and apply the configuration_keys_mapping.json file, and extracted common file header comments to a reusable constant.

Key changes:

  • Fixed JSON array extraction in ParseMappingFile method - the generator was incorrectly trying to extract the "mappings" field as an object instead of an array
  • Extracted configuration generator comments to Constants.ConfigurationGeneratorComment for reuse across multiple generators
  • Updated both ConfigurationKeysGenerator and ConfigKeyAliasesSwitcherGenerator to use the shared constant
  • Added documentation as to how to add a key now

Reason for change

The configuration_keys_mapping.json file was being ignored during code generation, causing the generator to produce incorrect constant names. This meant that any manual edits to constant names in the mapping file were not being respected, and the generated code would use auto-generated names instead of the explicitly mapped ones.

Additionally, the file header comments explaining that files are auto-generated were duplicated across generators, violating DRY principles.

Implementation details

  1. Fixed array extraction logic: Replaced the call to JsonReader.ExtractJsonObjectSection() with custom array extraction code that:

    • Finds the "mappings": key in the JSON
    • Locates the opening [ bracket
    • Tracks bracket nesting to find the matching closing ]
    • Extracts the complete array content
  2. Resolved variable scope issue: Reused existing inString and escapeNext variables from the outer scope instead of redeclaring them, fixing compilation errors.

  3. Centralized header comments: Created Constants.ConfigurationGeneratorComment containing the standardized auto-generation notice and updated both generators to use it.

Test coverage

  • Verified the generator builds successfully without errors
  • The mapping file is now properly parsed and applied during code generation
  • Generated constant names now match the mappings defined in configuration_keys_mapping.json

Other details

This fix ensures that the explicit naming conventions defined in configuration_keys_mapping.json are respected, maintaining consistency with the existing codebase and preventing future confusion when constant names don't match their expected values.

@anna-git anna-git changed the title [Config Registry] Anna/config inversion use generate config keys 5 [Config Registry] Replace manual ConfigurationKeys by generated ones in the whole solution Oct 22, 2025
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from a74a26f to 864cbb6 Compare October 22, 2025 15:45
@pr-commenter
Copy link

pr-commenter bot commented Oct 22, 2025

Benchmarks

Benchmarks Report for benchmark platform 🐌

Benchmarks for #7697 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.253
  • 2 benchmarks are slower, with geometric mean 1.157
  • 4 benchmarks have fewer allocations
  • 3 benchmarks have more allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartStopWithChild net6.0 10.6μs 59.2ns 360ns 0 0 0 5.51 KB
master StartStopWithChild netcoreapp3.1 14.3μs 73ns 350ns 0 0 0 5.73 KB
master StartStopWithChild net472 22.9μs 118ns 728ns 0.896 0.336 0 6.14 KB
#7697 StartStopWithChild net6.0 10.6μs 58.6ns 356ns 0 0 0 5.52 KB
#7697 StartStopWithChild netcoreapp3.1 13.6μs 68.8ns 315ns 0 0 0 5.71 KB
#7697 StartStopWithChild net472 22.4μs 125ns 793ns 0.968 0.215 0 6.11 KB
Benchmarks.Trace.AgentWriterBenchmark - Unknown 🤷 Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 N/A N/A N/A NaN NaN NaN 0 b
master WriteAndFlushEnrichedTraces netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
master WriteAndFlushEnrichedTraces net472 N/A N/A N/A NaN NaN NaN 0 b
#7697 WriteAndFlushEnrichedTraces net6.0 N/A N/A N/A NaN NaN NaN 0 b
#7697 WriteAndFlushEnrichedTraces netcoreapp3.1 N/A N/A N/A NaN NaN NaN 0 b
#7697 WriteAndFlushEnrichedTraces net472 N/A N/A N/A NaN NaN NaN 0 b
Benchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net6.0 1.08μs 5.79ns 33.3ns 0 0 0 1.22 KB
master AllCycleSimpleBody netcoreapp3.1 1.39μs 7.9ns 55.9ns 0 0 0 1.2 KB
master AllCycleSimpleBody net472 1.11μs 1.11ns 4.3ns 0.194 0 0 1.23 KB
master AllCycleMoreComplexBody net6.0 7.22μs 4.09ns 15.8ns 0 0 0 4.72 KB
master AllCycleMoreComplexBody netcoreapp3.1 9.35μs 43.6ns 175ns 0 0 0 4.62 KB
master AllCycleMoreComplexBody net472 7.58μs 3.67ns 14.2ns 0.718 0 0 4.74 KB
master ObjectExtractorSimpleBody net6.0 321ns 1.78ns 11ns 0 0 0 280 B
master ObjectExtractorSimpleBody netcoreapp3.1 405ns 1.99ns 8.42ns 0 0 0 272 B
master ObjectExtractorSimpleBody net472 299ns 0.178ns 0.667ns 0.0442 0 0 281 B
master ObjectExtractorMoreComplexBody net6.0 6.27μs 31.4ns 137ns 0 0 0 3.78 KB
master ObjectExtractorMoreComplexBody netcoreapp3.1 7.87μs 36.9ns 148ns 0 0 0 3.69 KB
master ObjectExtractorMoreComplexBody net472 6.6μs 1.21ns 4.53ns 0.598 0 0 3.8 KB
#7697 AllCycleSimpleBody net6.0 1.07μs 0.632ns 2.28ns 0 0 0 1.22 KB
#7697 AllCycleSimpleBody netcoreapp3.1 1.5μs 8.07ns 41.9ns 0 0 0 1.2 KB
#7697 AllCycleSimpleBody net472 1.06μs 0.465ns 1.8ns 0.19 0 0 1.23 KB
#7697 AllCycleMoreComplexBody net6.0 7.13μs 38.8ns 213ns 0 0 0 4.72 KB
#7697 AllCycleMoreComplexBody netcoreapp3.1 9.09μs 37.2ns 144ns 0 0 0 4.62 KB
#7697 AllCycleMoreComplexBody net472 8.13μs 6.45ns 25ns 0.728 0 0 4.74 KB
#7697 ObjectExtractorSimpleBody net6.0 325ns 0.626ns 2.42ns 0 0 0 280 B
#7697 ObjectExtractorSimpleBody netcoreapp3.1 396ns 2.2ns 12.6ns 0 0 0 272 B
#7697 ObjectExtractorSimpleBody net472 312ns 0.898ns 3.48ns 0.0434 0 0 281 B
#7697 ObjectExtractorMoreComplexBody net6.0 6.41μs 32.8ns 154ns 0 0 0 3.78 KB
#7697 ObjectExtractorMoreComplexBody netcoreapp3.1 7.99μs 36.8ns 143ns 0 0 0 3.69 KB
#7697 ObjectExtractorMoreComplexBody net472 7.18μs 4.53ns 17.6ns 0.572 0 0 3.8 KB
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EncodeArgs net6.0 76.3μs 214ns 828ns 0 0 0 32.4 KB
master EncodeArgs netcoreapp3.1 97.7μs 24.1ns 90.3ns 0 0 0 32.4 KB
master EncodeArgs net472 110μs 27ns 105ns 4.94 0 0 32.51 KB
master EncodeLegacyArgs net6.0 144μs 26ns 101ns 0 0 0 2.15 KB
master EncodeLegacyArgs netcoreapp3.1 201μs 755ns 2.93μs 0 0 0 2.15 KB
master EncodeLegacyArgs net472 265μs 142ns 551ns 0 0 0 2.16 KB
#7697 EncodeArgs net6.0 76.6μs 220ns 850ns 0 0 0 32.4 KB
#7697 EncodeArgs netcoreapp3.1 98.4μs 241ns 934ns 0 0 0 32.4 KB
#7697 EncodeArgs net472 110μs 20.1ns 75.2ns 4.97 0 0 32.51 KB
#7697 EncodeLegacyArgs net6.0 142μs 17.9ns 64.6ns 0 0 0 2.14 KB
#7697 EncodeLegacyArgs netcoreapp3.1 197μs 232ns 898ns 0 0 0 2.14 KB
#7697 EncodeLegacyArgs net472 263μs 56.4ns 219ns 0 0 0 2.16 KB
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ More allocations ⚠️

More allocations ⚠️ in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack‑net6.0 2.83 KB 3.5 KB 672 B 23.73%

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark‑net6.0 5.48 KB 5.14 KB -336 B -6.13%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunWafRealisticBenchmark net6.0 446μs 2.59μs 23.2μs 0 0 0 5.48 KB
master RunWafRealisticBenchmark netcoreapp3.1 473μs 2.77μs 25.8μs 0 0 0 4.58 KB
master RunWafRealisticBenchmark net472 492μs 356ns 1.28μs 0 0 0 0 b
master RunWafRealisticBenchmarkWithAttack net6.0 321μs 920ns 3.19μs 0 0 0 2.83 KB
master RunWafRealisticBenchmarkWithAttack netcoreapp3.1 362μs 3.19μs 31.1μs 0 0 0 2.32 KB
master RunWafRealisticBenchmarkWithAttack net472 368μs 449ns 1.68μs 0 0 0 0 b
#7697 RunWafRealisticBenchmark net6.0 428μs 2.03μs 8.63μs 0 0 0 5.14 KB
#7697 RunWafRealisticBenchmark netcoreapp3.1 460μs 2.57μs 20.2μs 0 0 0 4.58 KB
#7697 RunWafRealisticBenchmark net472 499μs 332ns 1.2μs 0 0 0 0 b
#7697 RunWafRealisticBenchmarkWithAttack net6.0 329μs 2μs 19.8μs 0 0 0 3.5 KB
#7697 RunWafRealisticBenchmarkWithAttack netcoreapp3.1 359μs 2.69μs 25.9μs 0 0 0 2.32 KB
#7697 RunWafRealisticBenchmarkWithAttack net472 371μs 144ns 519ns 0 0 0 0 b
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendRequest net6.0 60.6μs 36.8ns 133ns 0 0 0 14.52 KB
master SendRequest netcoreapp3.1 72.2μs 334ns 1.34μs 0 0 0 17.42 KB
master SendRequest net472 0.161ns 0.00536ns 0.0208ns 0 0 0 0 b
#7697 SendRequest net6.0 61.3μs 60.9ns 211ns 0 0 0 14.52 KB
#7697 SendRequest netcoreapp3.1 71.7μs 266ns 958ns 0 0 0 17.42 KB
#7697 SendRequest net472 0.162ns 0.00626ns 0.0242ns 0 0 0 0 b
Benchmarks.Trace.CharSliceBenchmark - Slower ⚠️ Fewer allocations 🎉

Slower ⚠️ in #7697

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice‑net6.0 1.126 1,425,350.00 1,605,500.00

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool‑net6.0 640 B 304 B -336 B -52.50%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master OriginalCharSlice net6.0 1.89ms 1.31μs 4.9μs 0 0 0 640.3 KB
master OriginalCharSlice netcoreapp3.1 3.99ms 1.21μs 4.19μs 0 0 0 640.1 KB
master OriginalCharSlice net472 2.66ms 1.44μs 5.59μs 0 0 0 647.17 KB
master OptimizedCharSlice net6.0 1.42ms 502ns 1.74μs 0 0 0 976 B
master OptimizedCharSlice netcoreapp3.1 2.77ms 1.17μs 4.53μs 0 0 0 104 B
master OptimizedCharSlice net472 1.92ms 1.12μs 4.18μs 0 0 0 0 b
master OptimizedCharSliceWithPool net6.0 1.01ms 744ns 2.88μs 0 0 0 640 B
master OptimizedCharSliceWithPool netcoreapp3.1 1.92ms 1.72μs 6.64μs 0 0 0 104 B
master OptimizedCharSliceWithPool net472 1.14ms 273ns 946ns 0 0 0 0 b
#7697 OriginalCharSlice net6.0 2ms 1.19μs 4.6μs 0 0 0 640.64 KB
#7697 OriginalCharSlice netcoreapp3.1 4ms 1.13μs 4.09μs 0 0 0 640.1 KB
#7697 OriginalCharSlice net472 2.64ms 538ns 1.94μs 0 0 0 647.17 KB
#7697 OptimizedCharSlice net6.0 1.61ms 902ns 3.37μs 0 0 0 976 B
#7697 OptimizedCharSlice netcoreapp3.1 2.81ms 1.6μs 6.18μs 0 0 0 104 B
#7697 OptimizedCharSlice net472 2.01ms 1.07μs 4.13μs 0 0 0 0 b
#7697 OptimizedCharSliceWithPool net6.0 1.09ms 1.09μs 4.2μs 0 0 0 304 B
#7697 OptimizedCharSliceWithPool netcoreapp3.1 1.86ms 2.6μs 10.1μs 0 0 0 104 B
#7697 OptimizedCharSliceWithPool net472 1.14ms 729ns 2.82μs 0 0 0 0 b
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Faster 🎉 Fewer allocations 🎉

Faster 🎉 in #7697

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑netcoreapp3.1 1.253 757,519.87 604,379.02

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces‑net6.0 42.23 KB 41.85 KB -386 B -0.91%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net6.0 714μs 3.63μs 16.6μs 0 0 0 42.23 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 746μs 4.1μs 24.9μs 0 0 0 41.86 KB
master WriteAndFlushEnrichedTraces net472 939μs 4.3μs 23.2μs 4.46 0 0 55.79 KB
#7697 WriteAndFlushEnrichedTraces net6.0 766μs 483ns 1.87μs 0 0 0 41.85 KB
#7697 WriteAndFlushEnrichedTraces netcoreapp3.1 605μs 770ns 2.98μs 0 0 0 41.93 KB
#7697 WriteAndFlushEnrichedTraces net472 885μs 2.8μs 10.1μs 4.46 0 0 55.61 KB
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net6.0 1.91μs 8.67ns 33.6ns 0 0 0 1.02 KB
master ExecuteNonQuery netcoreapp3.1 2.53μs 5.29ns 20.5ns 0 0 0 1.02 KB
master ExecuteNonQuery net472 2.74μs 3.2ns 12.4ns 0.151 0 0 987 B
#7697 ExecuteNonQuery net6.0 1.88μs 9.42ns 41.1ns 0 0 0 1.02 KB
#7697 ExecuteNonQuery netcoreapp3.1 2.58μs 11.4ns 44.3ns 0 0 0 1.02 KB
#7697 ExecuteNonQuery net472 2.8μs 4.63ns 17.9ns 0.144 0 0 987 B
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net6.0 1.75μs 9.2ns 44.1ns 0 0 0 1.03 KB
master CallElasticsearch netcoreapp3.1 2.26μs 10.9ns 45.1ns 0 0 0 1.03 KB
master CallElasticsearch net472 3.48μs 1.22ns 4.56ns 0.157 0 0 1.04 KB
master CallElasticsearchAsync net6.0 1.87μs 7.73ns 30ns 0 0 0 1.01 KB
master CallElasticsearchAsync netcoreapp3.1 2.41μs 7.48ns 25.9ns 0 0 0 1.08 KB
master CallElasticsearchAsync net472 3.69μs 4.57ns 17.7ns 0.167 0 0 1.1 KB
#7697 CallElasticsearch net6.0 1.7μs 9.33ns 52ns 0 0 0 1.03 KB
#7697 CallElasticsearch netcoreapp3.1 2.39μs 3.69ns 14.3ns 0 0 0 1.03 KB
#7697 CallElasticsearch net472 3.52μs 1.71ns 6.4ns 0.158 0 0 1.04 KB
#7697 CallElasticsearchAsync net6.0 1.93μs 9.75ns 44.7ns 0 0 0 1.01 KB
#7697 CallElasticsearchAsync netcoreapp3.1 2.4μs 8.52ns 33ns 0 0 0 1.08 KB
#7697 CallElasticsearchAsync net472 3.75μs 7.66ns 28.7ns 0.169 0 0 1.1 KB
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net6.0 1.92μs 7.18ns 27.8ns 0 0 0 952 B
master ExecuteAsync netcoreapp3.1 2.45μs 8.55ns 33.1ns 0 0 0 952 B
master ExecuteAsync net472 2.58μs 2.98ns 11.5ns 0.141 0 0 915 B
#7697 ExecuteAsync net6.0 1.92μs 8.62ns 34.5ns 0 0 0 952 B
#7697 ExecuteAsync netcoreapp3.1 2.48μs 10.4ns 40.4ns 0 0 0 952 B
#7697 ExecuteAsync net472 2.72μs 5.92ns 22.9ns 0.135 0 0 915 B
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net6.0 7μs 11.5ns 44.4ns 0 0 0 2.36 KB
master SendAsync netcoreapp3.1 8.7μs 19.8ns 76.9ns 0 0 0 2.9 KB
master SendAsync net472 12.3μs 7.96ns 29.8ns 0.489 0 0 3.18 KB
#7697 SendAsync net6.0 6.93μs 6.75ns 25.3ns 0 0 0 2.36 KB
#7697 SendAsync netcoreapp3.1 8.82μs 20.9ns 78ns 0 0 0 2.9 KB
#7697 SendAsync net472 12.3μs 16ns 61.9ns 0.489 0 0 3.18 KB
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower ⚠️ More allocations ⚠️

Slower ⚠️ in #7697

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 1.188 459,050.00 545,350.00

More allocations ⚠️ in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark‑net472 57.34 KB 65.54 KB 8.19 KB 14.29%
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 273.29 KB 275.24 KB 1.95 KB 0.71%

Fewer allocations 🎉 in #7697

Benchmark Base Allocated Diff Allocated Change Change %
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑netcoreapp3.1 273.14 KB 258.05 KB -15.1 KB -5.53%

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StringConcatBenchmark net6.0 45μs 304ns 2.83μs 0 0 0 43.78 KB
master StringConcatBenchmark netcoreapp3.1 52.5μs 503ns 4.91μs 0 0 0 43.09 KB
master StringConcatBenchmark net472 57μs 278ns 1.15μs 0 0 0 57.34 KB
master StringConcatAspectBenchmark net6.0 460μs 1.51μs 8.01μs 0 0 0 273.29 KB
master StringConcatAspectBenchmark netcoreapp3.1 510μs 2.39μs 10.7μs 0 0 0 273.14 KB
master StringConcatAspectBenchmark net472 411μs 1.98μs 14.3μs 0 0 0 278.53 KB
#7697 StringConcatBenchmark net6.0 45.2μs 263ns 2.1μs 0 0 0 43.84 KB
#7697 StringConcatBenchmark netcoreapp3.1 49.9μs 272ns 2.43μs 0 0 0 43.02 KB
#7697 StringConcatBenchmark net472 56.6μs 221ns 827ns 0 0 0 65.54 KB
#7697 StringConcatAspectBenchmark net6.0 551μs 2.75μs 11.7μs 0 0 0 275.24 KB
#7697 StringConcatAspectBenchmark netcoreapp3.1 502μs 1.37μs 4.75μs 0 0 0 258.05 KB
#7697 StringConcatAspectBenchmark net472 410μs 2.29μs 15.2μs 0 0 0 278.53 KB
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 2.71μs 13.2ns 54.3ns 0 0 0 1.7 KB
master EnrichedLog netcoreapp3.1 3.62μs 12.5ns 48.5ns 0 0 0 1.7 KB
master EnrichedLog net472 3.95μs 6.07ns 23.5ns 0.254 0 0 1.64 KB
#7697 EnrichedLog net6.0 2.73μs 2.3ns 8.6ns 0 0 0 1.7 KB
#7697 EnrichedLog netcoreapp3.1 3.67μs 17.4ns 71.6ns 0 0 0 1.7 KB
#7697 EnrichedLog net472 3.88μs 2.51ns 9.73ns 0.253 0 0 1.64 KB
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 123μs 78.6ns 305ns 0 0 0 4.31 KB
master EnrichedLog netcoreapp3.1 126μs 43ns 161ns 0 0 0 4.31 KB
master EnrichedLog net472 165μs 56.7ns 204ns 0 0 0 4.51 KB
#7697 EnrichedLog net6.0 123μs 95ns 329ns 0 0 0 4.31 KB
#7697 EnrichedLog netcoreapp3.1 127μs 156ns 585ns 0 0 0 4.31 KB
#7697 EnrichedLog net472 168μs 147ns 570ns 0 0 0 4.52 KB
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 5.17μs 21.3ns 82.6ns 0 0 0 2.26 KB
master EnrichedLog netcoreapp3.1 7.06μs 15.3ns 57.1ns 0 0 0 2.26 KB
master EnrichedLog net472 7.73μs 5.53ns 21.4ns 0.307 0 0 2.08 KB
#7697 EnrichedLog net6.0 5.06μs 16.6ns 64.4ns 0 0 0 2.26 KB
#7697 EnrichedLog netcoreapp3.1 6.82μs 20.1ns 77.7ns 0 0 0 2.26 KB
#7697 EnrichedLog net472 7.59μs 8.87ns 33.2ns 0.304 0 0 2.08 KB
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendReceive net6.0 2.15μs 1.92ns 7.2ns 0 0 0 1.2 KB
master SendReceive netcoreapp3.1 2.65μs 12.6ns 52ns 0 0 0 1.2 KB
master SendReceive net472 3.11μs 5.92ns 22.9ns 0.185 0 0 1.2 KB
#7697 SendReceive net6.0 1.93μs 9.94ns 48.7ns 0 0 0 1.2 KB
#7697 SendReceive netcoreapp3.1 2.73μs 9.75ns 37.7ns 0 0 0 1.2 KB
#7697 SendReceive net472 3.13μs 3.49ns 13.5ns 0.188 0 0 1.2 KB
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master EnrichedLog net6.0 4.36μs 11.4ns 44.1ns 0 0 0 1.58 KB
master EnrichedLog netcoreapp3.1 5.82μs 16.5ns 64ns 0 0 0 1.63 KB
master EnrichedLog net472 6.56μs 9.44ns 36.5ns 0.299 0 0 2.03 KB
#7697 EnrichedLog net6.0 4.26μs 19.6ns 78.3ns 0 0 0 1.58 KB
#7697 EnrichedLog netcoreapp3.1 5.64μs 14.7ns 56.9ns 0 0 0 1.63 KB
#7697 EnrichedLog net472 6.65μs 7.36ns 28.5ns 0.298 0 0 2.03 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net6.0 782ns 3.87ns 16.4ns 0 0 0 576 B
master StartFinishSpan netcoreapp3.1 984ns 4.62ns 17.9ns 0 0 0 576 B
master StartFinishSpan net472 917ns 0.137ns 0.514ns 0.0879 0 0 578 B
master StartFinishScope net6.0 932ns 4.67ns 20.9ns 0 0 0 696 B
master StartFinishScope netcoreapp3.1 1.17μs 5.15ns 19.3ns 0 0 0 696 B
master StartFinishScope net472 1.13μs 0.23ns 0.86ns 0.102 0 0 658 B
master StartFinishTwoScopes net6.0 1.73μs 9.05ns 43.4ns 0 0 0 1.19 KB
master StartFinishTwoScopes netcoreapp3.1 2.24μs 11.4ns 54.5ns 0 0 0 1.19 KB
master StartFinishTwoScopes net472 2.2μs 1.84ns 6.89ns 0.166 0 0 1.08 KB
#7697 StartFinishSpan net6.0 794ns 3.64ns 14.6ns 0 0 0 576 B
#7697 StartFinishSpan netcoreapp3.1 964ns 4.96ns 23.8ns 0 0 0 576 B
#7697 StartFinishSpan net472 902ns 0.103ns 0.372ns 0.0903 0 0 578 B
#7697 StartFinishScope net6.0 950ns 0.335ns 1.3ns 0 0 0 696 B
#7697 StartFinishScope netcoreapp3.1 1.15μs 6.02ns 28.2ns 0 0 0 696 B
#7697 StartFinishScope net472 1.13μs 1.11ns 4.31ns 0.102 0 0 658 B
#7697 StartFinishTwoScopes net6.0 1.76μs 8.84ns 40.5ns 0 0 0 1.19 KB
#7697 StartFinishTwoScopes netcoreapp3.1 2.25μs 11.6ns 58.2ns 0 0 0 1.19 KB
#7697 StartFinishTwoScopes net472 2.18μs 2.24ns 8.69ns 0.162 0 0 1.08 KB
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master RunOnMethodBegin net6.0 1.1μs 1.17ns 4.52ns 0 0 0 696 B
master RunOnMethodBegin netcoreapp3.1 1.42μs 7.26ns 33.3ns 0 0 0 696 B
master RunOnMethodBegin net472 1.43μs 1.4ns 5.43ns 0.101 0 0 658 B
#7697 RunOnMethodBegin net6.0 1.08μs 0.437ns 1.69ns 0 0 0 696 B
#7697 RunOnMethodBegin netcoreapp3.1 1.39μs 7.24ns 36.9ns 0 0 0 697 B
#7697 RunOnMethodBegin net472 1.5μs 2.37ns 9.18ns 0.104 0 0 658 B

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from c1f7943 to 56bd199 Compare October 22, 2025 17:26
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch 2 times, most recently from a70301b to caf072d Compare October 22, 2025 17:50
@anna-git anna-git changed the base branch from anna/config-inversion-configuration-analyzers-4 to master October 22, 2025 18:01
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch 2 times, most recently from 52bf0a8 to 38efd42 Compare October 22, 2025 18:27
@anna-git anna-git changed the base branch from master to anna/config-inversion-configuration-analyzers-4 October 22, 2025 18:30
@datadog-official
Copy link

datadog-official bot commented Oct 22, 2025

⚠️ Tests

⚠️ Warnings

🧪 45 Tests failed

TestDirectoryListingLeak from Datadog.Trace.Security.IntegrationTests.Iast.AspNetCore5IastTestsRestartedSampleIastEnabled (Datadog)
Unable to determine port application is listening on
AddsObsoleteAttributeForDeprecatedKeys from Datadog.Trace.SourceGenerators.Tests.ConfigurationKeysGeneratorTests (Datadog)
Expected mainOutput "// <copyright company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>
// <auto-generated/>

#nullable enable

namespace Datadog.Trace.Configuration;

...
AddsObsoleteAttributeForDeprecatedKeys from Datadog.Trace.SourceGenerators.Tests.ConfigurationKeysGeneratorTests (Datadog)
Expected string "// <copyright company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>
// <auto-generated/>

#nullable enable

namespace Datadog.Trace.Configuration;

...
View all

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9e16b03 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 83d9c7d to 22a4a69 Compare October 22, 2025 19:40
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 38efd42 to 77c76ec Compare October 22, 2025 19:40
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 22a4a69 to 8c8402b Compare October 22, 2025 20:12
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 77c76ec to 5959568 Compare October 22, 2025 20:12
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 8c8402b to 15b3e9b Compare October 22, 2025 21:02
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 5959568 to 0672899 Compare October 22, 2025 21:02
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 15b3e9b to 071fbd4 Compare October 22, 2025 21:25
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 0672899 to 64b591b Compare October 22, 2025 21:25
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 071fbd4 to 0a751b8 Compare October 22, 2025 21:31
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 64b591b to 4b52ac0 Compare October 22, 2025 21:31
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 0a751b8 to f5dd040 Compare October 22, 2025 22:22
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 4b52ac0 to cf4f9e4 Compare October 22, 2025 22:22
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from f5dd040 to df4a547 Compare October 22, 2025 22:48
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from cf4f9e4 to d5e1ed2 Compare October 22, 2025 22:48
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 9860a88 to 3197af6 Compare October 30, 2025 18:03
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch 2 times, most recently from 4289adc to efb749a Compare October 30, 2025 19:39
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 3197af6 to e6d6574 Compare October 30, 2025 20:46
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from efb749a to 4a09baa Compare October 30, 2025 20:47
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from e6d6574 to dcd2f3c Compare October 31, 2025 01:39
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 4a09baa to 6d0d644 Compare October 31, 2025 01:39
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from dcd2f3c to 196d5e0 Compare October 31, 2025 21:41
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 6d0d644 to 0949fba Compare October 31, 2025 21:41
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 196d5e0 to 3d682bd Compare November 25, 2025 16:33
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 0949fba to 4f85efe Compare November 25, 2025 16:33
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 3d682bd to e99b9b3 Compare November 25, 2025 20:08
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 4f85efe to 3ea1404 Compare November 25, 2025 20:08
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from e99b9b3 to 667cda0 Compare November 25, 2025 20:35
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 3ea1404 to 9662e0f Compare November 25, 2025 20:35
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 667cda0 to 888141d Compare November 25, 2025 20:51
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 9662e0f to 6f43191 Compare November 25, 2025 20:51
anna-git added a commit that referenced this pull request Nov 26, 2025
…#7698)

## Context

Part of **Configuration Inversion (Step 3)** - Stack progress:
1. [#7548](#7548) - Add
GitLab step and JSON configuration file
2. [#7688](#7688) -
Cleanup configuration / platform keys + analyzers
3. **→ [#7698](#7698) -
Generate ConfigurationKeys with source generator (this PR)**
4. [#7689](#7689) -
Aliases handling via source generator
5. [#7697](#7697) -
Replace manual ConfigurationKeys by generated ones in the whole solution

## Summary

Adds source generator to auto-generate `ConfigurationKeys` from
`supported-configurations.json` with name mapping to preserve existing
constant names.

## Changes

**Source Generator:**
-
[ConfigurationKeysGenerator](cci:7://file:///var/folders/4j/q1f1tvc503g_thnq6p79cp500000gp/T/SourceGeneratedDocuments/D0E9C9C62821E2CB6FADE080/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator:0:0-0:0)
reads `supported-configurations.json` and
[supported-configurations-docs.yaml](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Configuration/supported-configurations-docs.yaml:0:0-0:0)
- Auto-generates `ConfigurationKeys` with nested product classes
(AppSec, CIVisibility, OpenTelemetry, etc.)
- Generates XML documentation and `[Obsolete]` attributes from JSON

**Configuration Mapping:**
- `configuration_keys_mapping.json` maps env vars to original constant
names (e.g., `DD_TRACE_ENABLED` → `TraceEnabled`)
- Avoids refactoring hundreds of references across codebase

**Updates:**
- Added missing `DD_TRACE_ACTIVITY_LISTENER_ENABLED` key
- Committed temporary
[ConfigurationKeys2.g.cs](cci:7://file:///Users/anna.yafi/go/src/github.com/DataDog/dd-trace-dotnet3/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/ConfigurationKeysGenerator/ConfigurationKeys2.g.cs:0:0-0:0)
files for validation

## Motivation

Makes `supported-configurations.json` the single source of truth while
preserving existing constant names to avoid massive refactoring.

## Test Coverage

- Added `ConfigurationKeysGeneratorTests.cs` with comprehensive unit
tests
- Tests validate generator output, XML documentation generation, and
obsolete attribute application
- Tests cover nested product classes, deprecations, and YAML
documentation integration
- All existing tests pass without modification

## Related Work

Builds on #7548 (configuration registry) and #7688 (PlatformKeys
separation + analyzers).
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 888141d to 1a1742c Compare November 28, 2025 14:31
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 6f43191 to 2bba95f Compare November 28, 2025 14:31
@anna-git anna-git force-pushed the anna/config-inversion-configuration-analyzers-4 branch from 1a1742c to 13b5134 Compare December 1, 2025 15:59
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 07aaab2 to 8b47c49 Compare December 1, 2025 16:00
@anna-git anna-git force-pushed the anna/config-inversion-use-generate-config-keys-5 branch from 8b47c49 to 9e16b03 Compare December 1, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants